package com.example.novelsys.dao;


import com.example.novelsys.entity.Favorites;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface FavoritesDao {

	//根据用户id查询收藏的小说
	@Select("select * from favorites where userId=#{userId} ")
	  public List<Favorites> queryByID(Long userId);
	  
	  
	  
	  //根据小说id删除收藏
	@Delete("delete from favorites where novelId=#{novelId} ")
	    public Integer deleteByNovelId(Integer novelId);
	    
	    
	    //根据小说id删除收藏
	@Delete("delete from favorites where favoriteId=#{favoriteId} ")
	    public Integer deleteByKey(Integer favoriteId);
	    
	    
	  //添加收藏
	@Insert("insert into favorites values (null, #{userId}, #{novelId}, now())   ")
	    public int addFavorites(Favorites   favorites);
	    
	   

}
